import django_filters

from HttpTestcase.models import TestsuiteSet
from apps.HttpTestcase.models import Envs


class TestsuiteSetFilters(django_filters.rest_framework.FilterSet):
    """
    场景集筛选
    """

    # iexact表示精确匹配, 并且忽略大小写
    # icontains表示模糊查询（包含），并且忽略大小写
    # exact表示精确匹配
    project = django_filters.CharFilter(field_name='project_id', lookup_expr='exact')
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
    testsuite = django_filters.CharFilter(field_name='testsuite', lookup_expr='exact')
    level = django_filters.CharFilter(field_name='level', lookup_expr='exact')

    class Meta:
        model = TestsuiteSet
        fields = ['project', 'name', 'testsuite', 'level']